package org.fastsyncer.server.jetty;

import java.io.File;

import org.fastsyncer.common.constant.CommonConstant;
import org.fastsyncer.common.util.ApplicationUtil;

public enum JettyServerEnum {

	/**
	 * server.port
	 */
	PORT(CommonConstant.SERVER_PORT, ApplicationUtil.getKey(CommonConstant.SERVER_PORT)),
	/**
	 * context
	 */
	CONTEXT(CommonConstant.SERVER_CONTEXT, ApplicationUtil.getKey(CommonConstant.SERVER_CONTEXT)),
	/**
	 * 获取web.path项目路径,例如D:\Git\repo\fastsyncer\fastsyncer-web
	 */
	WEB_PATH(CommonConstant.SERVER_WEB_PATH, new File(new File("").getAbsolutePath()).getParent() + File.separatorChar + "fastsyncer-web"),
	/**
	 * 获取root路径,例如D:\Git\repo\fastsyncer\fastsyncer-web\src\main\resources
	 */
	ROOT(CommonConstant.SERVER_ROOT, JettyServerEnum.WEB_PATH.getValue() + File.separatorChar + "src" + File.separatorChar + "main" + File.separatorChar + "resources"),
	/**
	 * 获取web.xml,例如D:\Git\repo\fastsyncer\fastsyncer-web\src\main\resources\WEB-INF\web.xml
	 */
	ROOT_DESCRIPTOR(CommonConstant.SERVER_ROOT_DESCRIPTOR, JettyServerEnum.ROOT.getValue() + File.separatorChar + "WEB-INF" + File.separatorChar + "web.xml"),
	
	/**
	 * 获取root路径,例如D:\Git\repo\fastsyncer\fastsyncer-zip\UI
	 */
	DEF_ROOT(JettyServerEnum.ROOT.getKey(), new File("").getAbsolutePath() + File.separatorChar + "ui"),
	/**
	 * 获取web.xml,例如D:\Git\repo\fastsyncer\fastsyncer-zip\UI\WEB-INF\web.xml
	 */
	DEF_ROOT_DESC(JettyServerEnum.ROOT_DESCRIPTOR.getKey(), JettyServerEnum.DEF_ROOT.getValue() + File.separatorChar + "WEB-INF" + File.separatorChar + "web.xml");

	private String key;
	private String value;

	private JettyServerEnum(String key, String value) {
		this.key = key;
		this.value = value;
	}

	public String getKey() {
		return key;
	}

	public void setKey(String key) {
		this.key = key;
	}

	public String getValue() {
		return value;
	}

	public void setValue(String value) {
		this.value = value;
	}

}
